package com.mangowang.module.main.adapter;

import android.content.Context;
import android.graphics.Color;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.mangowang.lib.common.proto.Mystock;
import com.mangowang.module.main.R;

import java.util.List;


public class AllocMachineAdapter extends BaseQuickAdapter<Mystock.myMachineType.goodsInfo, BaseViewHolder> {
    public AllocMachineAdapter(Context context, List<Mystock.myMachineType.goodsInfo> dataList) {
        super(R.layout.item_alloca_machine, dataList);
    }

    @Override
    protected void convert(BaseViewHolder helper, Mystock.myMachineType.goodsInfo item) {
        helper.setText(R.id.tv_name, item.getGoodsName())
                .setText(R.id.tv_no_use, "("+item.getMsg()+")");
        if (item.getMsg().equals("")) {
            helper.setVisible(R.id.tv_no_use, false)
                    .setVisible(R.id.iv_next, false)
                    .setTextColor(R.id.tv_name, Color.parseColor("#192944"));
        } else {
            helper.setVisible(R.id.tv_no_use, true)
                    .setVisible(R.id.iv_next, false)
                    .setTextColor(R.id.tv_name, Color.parseColor("#ffb7c0cf"));
        }
    }
}